<template>
    <transition :name="transition">
        <div class="loading" v-if="show">
            <div :class="classObject" class="maincontent">
                    <div class="loadingimg"></div>
                    <p class="content" v-if="!!text">{{text}}</p>
            </div>
        </div>
    </transition>
</template>

<script>
export default {
    data() {
        return {
            show: false
        }
    },
    props: {
        text: {
            type: String,
            default: ''
        }
    },
    computed: {
        classObject() {
            return {
                toast: true,
                'toast-default': !this.text,
                'toast-text': !!this.text
            }
        }
    }
}
</script>

<style lang="less" scoped>
.pos() {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}
.loading {
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0,0);
    .pos();
    .mask {
        .pos();
        width: 100%;
        height: 100%;
    }
    .toast {
        .pos();
        top: 45%;
        left: 50%;
        z-index: 1001;
        width: 150px;
        height: 150px;
        font-size: 0;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0,0.75);
        text-align: center;
        color: #fff;
        border-radius: 10px;
        .icon {
            width: 50px;
            height: 50px;
            stroke-width: 0;
            stroke: currentColor;
            fill: currentColor;
            animation: animation-loading 1s steps(12, end) infinite;
        }
    }
    .toast-default {
        .icon {
            margin-top: 25px;
        }
    }
    .toast-text {
        // width: 80px;
        // height: 80px;
        .icon {
            margin-top: 30px;
        }
        .content {
            font-size: 24px;
            margin-top: 18px;
        }
    }
    .maincontent{
        padding:26px 0;
        .loadingimg{
            width: 60px;
            height: 60px;
            margin: 0 auto;
            animation: Loading 1s steps(12, end) infinite;
            background: transparent url("") no-repeat;
            background-size: 100%;
        }
    
    }
    @keyframes Loading{
        0% {
            transform: rotate3d(0, 0, 1, 0deg);
        }
        100% {
            transform: rotate3d(0, 0, 1, 360deg);
        }
    }
}
</style>
